<ui:composition 
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:c="http://java.sun.com/jsp/jstl/core"    
    xmlns:composite="http://java.sun.com/jsf/composite">
    <composite:interface>
        <composite:attribute name="theme" type="java.lang.String"/>
        <composite:attribute name="jquery" default="true"/>
        <composite:attribute name="jquery-ui" default="true"/>
    </composite:interface>


    <composite:implementation>
        <c:if test="#{not empty cc.attrs.theme}">
            <h:outputStylesheet name="#{cc.attrs.theme}"/>
        </c:if>
        <h:outputStylesheet library="deltaset.faces" name="css/deltaset-faces.css"/>
        <c:if test="#{true==cc.attrs.jquery}">
            <h:outputScript library="deltaset.faces" name="js/jquery-1.6.2.min.js" target="head"/>
        </c:if>
        <h:outputScript library="deltaset.faces" name="js/jquery.blockUI-2.31.js" target="head"/>
        <c:if test="#{true==cc.attrs['jquery-ui']}">
            <h:outputScript library="deltaset.faces" name="js/jquery-ui-1.8.16.custom.min.js" target="head"/>
            <h:outputScript library="deltaset.faces" name="js/jquery.fileupload.js" target="head"/>
            <h:outputScript library="deltaset.faces" name="js/jquery.iframe-transport.js" target="head"/>
        </c:if>
        <h:outputScript library="deltaset.faces" name="js/deltaset-faces.js" target="head"/>
		<h:outputScript library="deltaset.faces" name="js/jquery.deltaset-plugins.js" target="head"/>
        <h:outputScript name="jsf.js" library="javax.faces" target="head"/>

        <h:outputScript target="head">
            //setting labels of deltaset javascript library... needed for localization of cancel, ok and loading
            deltaset.loadingLabel='#{deltasetMessages['deltaset.loading']}';
            deltaset.okLabel='#{deltasetMessages['deltaset.confirm.ok']}';
            deltaset.cancelLabel='#{deltasetMessages['deltaset.confirm.cancel']}';
            deltaset.confirmQuestionLabel='#{deltasetMessages['deltaset.confirm.question']}';
            deltaset.confirmTitleLabel='#{deltasetMessages['deltaset.confirm.title']}';

            //global jsf.ajax handlers... could be useful for applying a security,
            //exceptionhandling, session timeout...
            //the applying of stylescould be handled in a central way
            //like deltaset.applyStyle()
            //probably should go in separate component in the specific 'page' definition


            //Register a callback for error handling.
            jsf.ajax.addOnError(deltaset.callbackOnError);
            //Register a callback for event handling.
            jsf.ajax.addOnEvent(deltaset.callbackOnEvent);

            //after document load, the styles should be initialized.
            jQuery(document).ready(deltaset.applyStyle);

        </h:outputScript>

    </composite:implementation>
</ui:composition>